namespace DotNetNuke.Security.Permissions.Controls
{
    using System;
    using System.Collections;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Web.UI.WebControls;

    public abstract class PermissionsGrid : DataGrid
    {
        private ArrayList _Permissions;
        private string[] _roles;

        public PermissionsGrid()
        {
            this.AutoGenerateColumns = false;
            this.CellSpacing = 0;
            this.Font.Size = FontUnit.XSmall;
            this.Font.Name = "Verdana";
            this.BorderStyle = BorderStyle.None;
            Unit refStructHelperS0 = new Unit(1);
            this.BorderWidth = refStructHelperS0;
            this.GridLines = GridLines.None;
            this.FooterStyle.BackColor = Color.White;
            this.HeaderStyle.ForeColor = Color.Black;
            this.HeaderStyle.BackColor = Color.White;
            this.HeaderStyle.Font.Bold = true;
        }

        public abstract void GenerateDataGrid();
        protected override void LoadViewState(object savedState)
        {
            base.LoadViewState(RuntimeHelpers.GetObjectValue(savedState));
            if (this.DynamicColumnAdded)
            {
                this.GenerateDataGrid();
            }
        }

        public bool DynamicColumnAdded
        {
            get
            {
                if (this.ViewState["ColumnAdded"] == null)
                {
                    return false;
                }
                return true;
            }
            set
            {
                this.ViewState["ColumnAdded"] = value;
            }
        }
    }
}

